require("Interactor")

IntercectionWithPropertyInteractor = class("IntercectionWithPropertyInteractor", Interactor)

---

function IntercectionWithPropertyInteractor:initialize(externalEntity, propertyName)

	Interactor.initialize(self)
	
	self.externalEntity = externalEntity
	self.propertyName = propertyName
end

---

function IntercectionWithPropertyInteractor:decohere(sourcePropertyValueSet)

	local intercection = {}
	
	for sourcePropertyValue, sourceProbability in pairs(sourcePropertyValueSet)
	do			
		if self.externalEntity.properties[self.propertyName][sourcePropertyValue]
		then
			intercection[sourcePropertyValue] = sourceProbability
		end
	end

	return intercection
end